<template>
  <div>
    <el-dialog :visible="dialogTableVisible" width="40%" style="border-radius: 50px;" @close="close">
      <template slot="title">
        <span style="font-weight: 700;">新增合作商</span>
      </template>
      <el-form ref="resetFields" :model="form" :rules="rules">
        <el-form-item label="合作商名称" label-width="120px" prop="name">
          <el-input v-model="form.name" autocomplete="off" placeholder="请输入" maxlength="10" show-word-limit style="width: 450px;" />
        </el-form-item>
        <el-form-item label="联系人" label-width="120px" prop="contact">
          <el-input v-model="form.contact" autocomplete="off" placeholder="请输入" maxlength="10" show-word-limit style="width: 450px;" />
        </el-form-item>
        <el-form-item label="联系电话" label-width="120px" prop="mobile">
          <el-input v-model="form.mobile" autocomplete="off" placeholder="请输入" maxlength="11" show-word-limit style="width: 450px;" />
        </el-form-item>
        <el-form-item label="分成比例(%)" label-width="120px" prop="ratio">
          <el-input v-model="form.ratio" autocomplete="off" placeholder="请输入" style="width: 450px;">
            <div slot="suffix">
              <i class="el-icon-arrow-up" />
              <i class="el-icon-arrow-down" />
            </div>
          </el-input>
        </el-form-item>

        <el-form-item label="账号" label-width="120px" prop="account">
          <el-input v-model="form.account" autocomplete="off" placeholder="请输入" maxlength="18" show-word-limit style="width: 450px;" />
        </el-form-item>
        <el-form-item label="密码" label-width="120px" prop="password">
          <el-input v-model="form.password" autocomplete="off" placeholder="请输入" maxlength="20" show-word-limit style="width: 450px;" />
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer" style="display: flex; justify-content: center;margin-bottom: 20px;">
        <el-button style="background-color: #fbf4f0;border: none;" @click="close">取 消</el-button>
        <el-button type="primary" style="background-color: #ff6826;border: none;" @click="queRen">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: '',
  props: {
    dialogTableVisible: Boolean
  },
  data() {
    return {
      form: {
        name: '',
        contact: '',
        mobile: '',
        ratio: '',
        account: '',
        password: ''

      },
      rules: {
        name: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        contact: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        mobile: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        ratio: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        account: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {
  },
  created() {
  },
  methods: {
    close() {
      this.$emit('update:dialogTableVisible', false)
      this.$refs['resetFields'].resetFields()
    },
    // 确认按钮触发函数
    queRen() {
      this.$refs['resetFields'].validate((valid) => {
        if (valid) {
          this.$emit('update:dialogTableVisible', false)
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }

  }
}
</script>
<style lang='scss'  scoped>

 ::v-deep.el-textarea .el-textarea__inner   {
    height: 100px !important;
}
</style>
